$(function(){
    var demandId = params()["id"]
    $.ajax({
        url:server_url + '/rest/buyer/demand/demandDetail.do',
        data:{id:demandId,ran:Math.random()},
        success:function(data){
            console.log(data)
            var prod = data.data;
            $("#productName").text(prod.details[0].productname)
            $("#deadline").text("有效期至"+prod.deadline.substr(0,10))
            $("#category").text("类别："+prod.details[0].categoryName)
            $("#amount").text("数量："+prod.details[0].amount+"头")
            $("#price").text("价格："+prod.details[0].minprice+"-"+prod.details[0].maxprice+"元")
            $("#area").text("供货地址："+prod.details[0].deliveryarea+"")
            $("#buy").click(function(){
                window.location.href = server_url + '/buyer/demand/demandSupply.do?id='+demandId;
            })
        }
    })
});